Welcome to ‘Making API Requests using cURL
and Postman.’ After watching this video,
you will be able to explain how to use cURL to make HTTP requests,
and explain how to use Postman to make HTTP requests. Transferring data to and from a server requires
tools that support the necessary network protocols. Linux has multiple tools created for this
purpose, the most popular being curl. curl, short for "Client URL” is a command
line tool that enables data transfer over various network protocols. Developed in 1998, it has since been used
to communicate with web or application servers by specifying a relevant URL and the data
that need to be sent or received. curl can either be used at the command line
or in scripts to transfer data. You can run a simple curl command, as seen
in this example, and then view the output. The most common use cases for curl are: downloading files from the internet, endpoint testing, debugging, and error logging. Some of the common protocols supported by
curl are: HTTP, HTTPS, FTP, and IMAP. If you run this example curl command, you
will receive the output as shown. curl accepts a wide array of options, which
makes an extremely versatile command. Options start with one or two dashes, and if they do not require additional values,
the single-dash options can be written together. So, let’s breakdown the command and output. ‘Hyphen x’ means you are explicitly specifying
the HTTP function, which in this case is GET. We then specify the URL to evaluate. ‘Hyphen H’ allows you to define headers,
which in our case is telling the web server that we want to work with JSON. Our output is the list of products returned
by the product’s microservice represented in JSON. Now, Postman is an API platform for building and
using APIs based on a wide range of extremely user-friendly power tools, enabling the developers to easily create,
test, share, and document APIs. Postman simplifies each step of the API lifecycle
by allowing to orchestrate multiple requests which can be performed in several repetitions
or iterations, and help you streamline collaboration so you
can create better APIs—faster. And, due to its simplicity, it is one of the
most popular and convenient tools for testing a wide variety of APIs supporting many protocols for example, HTTP requests like GET, POST,
PUT, and PATCH--and then convert the API to code for languages like JavaScript and Python. A popular example is the WhatsApp Business
Platform Cloud API that has created a streamlined, developer-friendly experience using Postman. With Postman, onboarding time reduces to minutes
using automation and pre-filled data, which isn’t the case with alternative methods
that require manual setup. Developers can progress from signing up for
the WhatsApp Business Platform to testing phone numbers and building message calls in
a few minutes. You can download Postman to your computer
or you can use the online version. For this course, we will use the online version
which you will need to sign up for, and we will cover the steps in the next lab. Let’s now call the products microservice GET
endpoint using Postman. Once in Postman, start with a new tab; the
request type is GET, and the URL is the one where your microservice
is hosted. Then click on the Send button
to analyze the output. You can then save this in your workspace to
call your API again in the future. In this video, you learned that: cURL is used for transferring data with URLs, cURL can be used at a command line or in scripts, Postman is an API platform for building and
using APIs, and Postman is a simple and popular tool for
testing APIs.